<template>
	<view scroll-with-animation scroll-y style="height:100vh;position: relative;background-color: #FFFFFF;">
		<view class="list pl25 pr25" style="text-align: center;background-color: #FFFFFF;padding-top: 10rpx;" v-if="followList&&followList.length>0">
			<view class="chufang-card" v-for=" item in followList" :key="item.id" @click="toxqInfo(item.id)">
				<view class="chufang-card-row" style="border-bottom: 2rpx solid #D5D5D5;padding-bottom: 20rpx;margin-bottom: 20rpx;">
					<text style="color: #00BAAD;font-size: 30rpx;font-weight: bolder;">问诊随访表</text>
					<text style="color: #B0B0B0;">查看详情</text>
				</view>
				<view class="chufang-card-row">
					<text style="">诊断结果：</text>
					<text>{{item.diseaseName}}</text>
				</view>
				<view class="chufang-card-row">
					<text style="">主治医师：</text>
					<text>{{item.docName}}</text>
				</view>
				<view class="chufang-card-row">
					<text style="">身体情况：</text>
					<text>{{item.flowBody}}</text>
				</view>
				<view class="chufang-card-row" v-if="item.flowTime!=''&&item.flowTime!=null">
					<text style="">随访时间：</text>
					<text>{{changeDateFormat(item.flowTime)}}</text>
				</view>
				<view class="chufang-card-row" v-if="item.flowTime==''||item.flowTime==null">
					<text style="">随访时间：</text>
					<text @click="toxqInfo(item.id)">待填写</text>
				</view>
			</view>
			<!-- <uni-load-more :status="message" :contentText="contentText" @clickLoadMore="loadMore"></uni-load-more> -->
		</view>
		<view class="empty-list" v-else>
			<image style="height: 280rpx;" mode="heightFix" src="../../static/images/null.png"></image>
			<view style="color: #A7ADAD;margin-top: 20rpx;margin-bottom: 20rpx;">尚未查询到您的信息</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				wx: "https://app.mzmzb.com",
				userId:undefined,
				followList:[]
			};
		},
		onLoad(option) {
			console.log(option.userId)
			this.userId = option.userId
			this.queryFollowList();
		},
		methods: {
			//格式化时间
			changeDateFormat(cellval) {
			　	var dateVal = cellval + "";
			　　 if (cellval != null) {
			　　　　　　var date = new Date(parseInt(dateVal.replace("/Date(", "").replace(")/", ""), 10));
			　　　　　　var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
			　　　　　　var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
			　　　　　　var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
			　　　　　　var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
			　　　　　　var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
			　　　　　　return date.getFullYear() + "-" + month + "-" + currentDate + " " + hours + ":" + minutes + ":" + seconds;
			　　　　}
			},
			toxqInfo(id){
				uni.navigateTo({
				    url: '/pages3/suifangxq/index?followId='+id
				});
			},
			queryFollowList() {
				var that = this
				let openid=uni.getStorageSync('openId')
				uni.request({
					url: this.wx + '/application-usrapp/followUp/queryFollowList.tz',
					data: {
						usrUserId: this.userId
						// usrUserId: 5557
					},
					header: {
						'content-type': 'application/json',
						'usruserid':this.userId,
						'openid':openid,
						'hspid':this.hspId
					},
					success:(res) =>{
						if (res.data.success) {
							console.log(res)
							that.followList = JSON.parse(JSON.stringify(res.data.result));
						} else {
							uni.showToast({
								title: '查询失败'
							})
						}
					}
				})
			},
			//加载更多
			loadMore(e) {
				if (e.detail.status == 'more') {
					this.message = 'loading';
					this.current = this.current + 1;
					setTimeout(() => {
						this.getRecipieList()
						if (this.hasNextPage) {
							this.message = 'more';
						} else {
							this.message = 'noMore';
						}
					}, 500);
				}
			},
			formatDate(value) {
			  var date = new Date(value);
			  var y = date.getFullYear(),
			    m = date.getMonth() + 1,
			    d = date.getDate(),
			    h = date.getHours(),
			    i = date.getMinutes(),
			    s = date.getSeconds();
			  if (m < 10) { m = '0' + m; }
			  if (d < 10) { d = '0' + d; }
			  if (h < 10) { h = '0' + h; }
			  if (i < 10) { i = '0' + i; }
			  if (s < 10) { s = '0' + s; }
			  var t = y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s;
			  return t;
			}
		}
	};
</script>

<style lang="less">
	.list{
		.chufang-card{
			// border-top: 1rpx solid #efefef;
			// border: 1px solid #F2F9F9;
			// box-shadow: 0px 1px 17px 1px rgba(162, 215, 211, 0.16);
			border-radius: 32rpx;
			background-size: cover;
			// background-color: #FFFFFF;
			margin-top: 20rpx;
			margin-bottom: 40rpx;
			padding-left: 40rpx;
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			.chufang-card-row{
				width: calc(100% - 40rpx );
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 20rpx;
			}
			.chufang-btn{
				width: calc(100% - 40rpx);
				border-top: 5rpx solid #E6EAEA;
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				margin-top: 20rpx;
				display: flex;
				justify-content: flex-end;
			}
		}
	}
	.empty-list{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		width: 100vw;
		height: 100vh;
		background-color: #FFFFFF;
		.btn{
			width: 320rpx;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			color: #FFFFFF;
			background: linear-gradient(90deg, #23E0D3 0%, #00BAAD 100%);
			box-shadow: 0px 20rpx 25rpx 0px rgba(0, 186, 173, 0.4);
			border-radius: 10rpx;
		}
	}
	.list .chufang-card {
	    background-image: url();
	}
</style>
